<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./../templates/StakeholderPortalTemplate.xhtml">

    <link href="./../resources/css/default.css" rel="stylesheet" type="text/css" />
    <link href="./../resources/css/tableLayout.css" rel="stylesheet" type="text/css" />
    <h:head>
        <title>Advertising Management</title>
    </h:head>
    <ui:define name="left">

    </ui:define>

    <ui:define name="content">
        <f:view beforePhase="#{viewInboxManagedBean.initView}">

            <p:panel header="My Inbox">
                <p:messages id="statusMessages" redisplay="true" />
                <h:panelGrid columns="1" cellpadding="1" width="100%;">



                    <h:outputText id="resultList" value="Total Email in inbox: &nbsp; #{viewInboxManagedBean.messageList.size()}" 
                                  style="font-size: 10px; color: red; float: right;"/>

                    <p:dataTable id="adListTable" var="message" 
                                 rendered="true" value="#{viewInboxManagedBean.messageList}">

                        <!--<f:facet name="header">  
                            <p:outputPanel>  
                                <h:outputText value="Search all fields:" />  
                                <p:inputText id="globalFilter" onkeyup="viewInboxManagedBean.createFilterOptions" style="width:150px" />  
                            </p:outputPanel>  
                        </f:facet>  --> 

                        <p:column filterBy="#{message.sender}" style="width: 15%">  
                            <f:facet name="header">  
                                Sender
                            </f:facet>  
                            <h:outputText value="#{message.sender}" rendered="${message.action.see==true}"/>
                            <h:outputText value="#{message.sender}" rendered="${message.action.see==false}" style="font-weight: bold"/>

                        </p:column> 


                        <p:column filterBy="#{message.subject}" style="width: 60%">  
                            <f:facet name="header">  
                                Subject
                            </f:facet> 
                            
                            <h:outputText value="[ANNOUNCEMENT]" rendered="${message.msgType=='ANNOUNCEMENT'}" style="color: red; 
                                          font-weight: bold; font-size: smaller;"/>
                           
                            <h:commandLink value="#{message.subject}" rendered="${message.action.see==true}"
                                           actionListener="#{viewInboxManagedBean.view_Message(message)}" style="font-size: smaller;"/>

                            <h:commandLink value="#{message.subject}" rendered="${message.action.see==false}"
                                           actionListener="#{viewInboxManagedBean.view_Message(message)}" style="font-weight: bold; font-size: smaller;"/>
                        </p:column> 

                        <p:column>  
                            <f:facet name="header">  
                                Date
                            </f:facet>  
                            <h:outputText value="#{message.msgDate}" rendered="${message.action.see==true}" style="font-size: smaller;">
                                <f:convertDateTime dateStyle="medium" type="both" pattern="MMM dd, yyyy   HH:mm a" locale="UTC+8"/>
                            </h:outputText>

                            <h:outputText value="#{message.msgDate}" rendered="${message.action.see==false}" style="font-weight: bold;font-size: smaller;">
                                <f:convertDateTime dateStyle="medium" type="both" pattern="EEE, MMM dd, yyyy   HH:mm a"/>
                            </h:outputText>

                        </p:column> 



                    </p:dataTable>    


                </h:panelGrid>



            </p:panel>


        </f:view>
    </ui:define>
</ui:composition>
